// SKU管理模块相关接口
import request from '@/utils/request'
import { SkuResponseData, SkuINFOResponseData } from './type'

enum API {
  // 获取SKU列表
  GETSKU_URL = '/admin/product/list/',
  // 上架
  ONSALE_URL = '/admin/product/onSale/',
  // 下架
  CANCELSALE_URL = '/admin/product/cancelSale/',
  // SKU详情
  SKUINFO_URL = '/admin/product/getSkuInfo/',
  // 删除SKU
  DELETESKU_URL = '/admin/product/deleteSku/'

}

// 获取SKU列表的接口
export const reqSKUList = (pageNo: number, limit: number) => request.get<any, SkuResponseData>(API.GETSKU_URL + `${pageNo}/${limit}`)

// 上架接口
export const reqOnSale = (spuId: number) => request.get<any, any>(API.ONSALE_URL + spuId)

// 下架接口
export const reqCancelSale = (spuId: number) => request.get<any, any>(API.CANCELSALE_URL + spuId)

// 获取SKU详情
export const reqSkuINFO = (skuId: number) => request.get<any, SkuINFOResponseData>(API.SKUINFO_URL + skuId)

// 删除SKU
export const reqDeleteSku = (skuId: number) => request.delete<any, any>(API.DELETESKU_URL + skuId)
